import { LoaderHelp } from "../../../common/display/LoaderHelp";
import { ResFileConst } from "../../resource/ResFileConst";
import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../resource/ImagesConst";
type int = number;
//class FahunStarPanel
    
    export  class FahunStarPanel /* flash.display.Sprite */
    {
        constructor()
        {
            
            this._starArray = [];
            this.init();
            this.num = 0;
            return;
        }

        /* internal  */init(): void
        {
            var loc1=null;
            var loc2=0;
            while (loc2 < this._amount) 
            {
                loc1 = new Object /* flash.display.Bitmap */(new Object /* flash.display.BitmapData */(22, 20, true, 16777215));
                loc1.width = 22;
                loc1.height = 20;
                loc1.x = loc2 * 22 + 15;
                loc1.y = 5;
                this.addChild(loc1);
                this._starArray.push(loc1);
                ++loc2;
            }
            return;
        }

        public get num(): int
        {
            return this._num;
        }

        public set num(arg1: int)
        {
            this._num = arg1;
            this.updateStar();
            return;
        }

        /* internal  */updateStar(): void
        {
            LoaderHelp.addResCallBack(ResFileConst.fahun, this.onUpdateStarHandler);
            return;
        }

        /* internal  */clear(): void
        {
            var loc1=null;
            var loc2=0;
            while (loc2 < this._amount) 
            {
                loc1 = this._starArray[loc2];
                loc1.bitmapData = GlobalClass.getBitmapData(ImagesConst.FahunStar0);
                ++loc2;
            }
            return;
        }

        /* internal  */onUpdateStarHandler(): void
        {
            var loc1=null;
            this.clear();
            var loc2=0;
            while (loc2 < this._amount) 
            {
                loc1 = this._starArray[loc2];
                if (loc2 < this.num) 
                {
                    loc1.bitmapData = GlobalClass.getBitmapData(ImagesConst.FahunStar1);
                }
                else 
                {
                    loc1.bitmapData = GlobalClass.getBitmapData(ImagesConst.FahunStar0);
                }
                ++loc2;
            }
            return;
        }

        /* internal */ /* var */_amount: int=10;

        /* internal */ /* var */_starArray: Array<any>;

        /* internal */ /* var */_num: int;

        /* internal */ /* var */_starCount: int;
    }
